//
// Created by ChaoDONG on 2021-03-17.
//

#include<stdio.h>

int main(void){

    printf("  11/5= %2d   11%% 5 = %2d\n",11/5, 11%5);

    printf(" 11/-5= %2d   11%%-5 = %2d\n",11/-5, 11%-5);

    printf("-11/-5= %2d  -11%%-5 = %2d\n",-11/-5,-11%-5);

    printf(" -11/5= %2d  -11%% 5 = %2d\n",-11/5, -11%5);
    /* 无论何种情况，只要a和b都是整数值，便可通过a - (a/b)*b来计算a%b。
     * 可以这样计算-11%5：
    -11 - (-11/5) * 5 = -11 -(-2)*5 = -11 -(-10) = -1 */

    return 0;
}

